﻿namespace Core
{
    public class Player : Entity , IAwake
    {
        public static Player Instance;

        void IAwake.Awake()
        {
            Instance = this;

            var unit = GetParent<Unit>();

            var numbericComponent = unit.GetComponent<NumericComponent>();
            numbericComponent[NumericType.AttackRange] = 15000;
            numbericComponent[NumericType.moveSpeed] = 25000;
            numbericComponent[NumericType.rotateSpeed] = 500000;
            var buffComponent = unit.AddComponent<BuffComponent>();
            buffComponent.AddBuff(2);
            buffComponent.AddBuff(3);
            var skillComponent = unit.AddComponent<SkillComponent>();
            skillComponent.AddSkill(1);
            var stateMachine = unit.GetComponent<StateMachineComponent>();
            stateMachine.AddState(StateType.Idle, new IdleState());
            stateMachine.AddState(StateType.Move, new MoveState(unit));
            stateMachine.AddState(StateType.Attack, new AttackState(unit));
            stateMachine.ChangedState(StateType.Idle);

            unit.AddComponent<ItemContainerMgr>();
            unit.AddComponent<InventoryComponent>();
            unit.AddComponent<MoveComponent>();
            unit.AddComponent<CameraComponent>();
        }
    }

}